package com.mq.agency.controller;

import com.mq.agency.mq.MqConfig;
import com.mq.agency.vo.Stu;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description:
 * @author: zzb
 * @time: 2021/12/28 11:07
 */
@RestController
public class TestController {
    @Autowired
    private MqConfig mqConfig;
    @Autowired
    private RabbitTemplate rabbitTemplate;
    @GetMapping("/test")
    public Object test(){
        Stu stu=new Stu();
        stu.setAge(28);
        stu.setName("zb");
        stu.setExchangeName("test_ex");
        stu.setQueueName("test_queue");
        rabbitTemplate.convertAndSend(stu.getQueueName(),stu);
        return "ok";
    }
}
